import numpy as np

N, K = map(int, input().split())
arr = np.fromstring(input(), dtype=np.uint32, sep=' ')
arr.sort()
print(arr[K])